/* 
    应用中心-应用管理-管理详细-容器组模块组件
 */
<template>
    <el-table :data="contrainerDataLis" 
        v-loading="loadingTable" 
        highlight-current-row 
        style="width: 100%;">
        <!-- <el-table-column type="selection" width="40"> </el-table-column> -->
        <el-table-column  prop="opration"  width="50">
              <template slot-scope="scope">
                    <el-tooltip class="item" effect="light"  placement="top-start">
                        <div slot="content" v-if="scope.row.status === 'Running'">容器正常运行中</div>
                        <div slot="content" v-else-if="scope.row.status === 'ContainerCreating'">容器正在创建中</div>
                        <div slot="content" v-else>{{scope.row.statusMessage}}</div>
                        <i class='el-icon-success' style="color: rgb(0, 0, 255); font-size: 20px;" v-if="scope.row.status === 'Running'"></i>
                        <i class='el-icon-loading' style="color: rgb(0, 0, 255); font-size: 20px;" v-else-if="scope.row.status === 'ContainerCreating'"></i>
                        <i class='el-icon-warning' style="color: rgb(255, 0, 0); font-size: 20px;" v-else></i>
                    </el-tooltip>
              </template>
        </el-table-column>	
        <el-table-column prop="appNameKube" label="名称" ></el-table-column>
        <el-table-column  prop="status"  label="状态" ></el-table-column>
        <el-table-column  prop="restartCount"  label="重启次数" ></el-table-column>
        <el-table-column  prop="timeDiff"  label="创建时间" ></el-table-column>
        <el-table-column  prop="opration"  label="操作" >
            <template slot-scope="scope">
                <!-- <el-button  size="small" @click="loginPod(scope.$index, scope.row)">登陆终端</el-button> -->
                <el-button class="iconfont icon-huigun" type="danger" plain size="small" @click="reStartPod(scope.$index, scope.row)">重新部署</el-button>
            </template>
        </el-table-column>
    </el-table>
</template>

<script>
export default {
    // 数据初始化
    data() {

        return {
            // table
            //contrainerDataLis:[],
            // 是否加载table
            //loadingTable: false,
        }
        
    },
    // 组件参数
    props: [
        'contrainerDataLis', 
        'loadingTable', // 是否加载table
        'reStartPod',
    ],
    // 组件方法集合
    methods: {
        // 描述table行的颜色,以显示某种状态
        tableRowClassName(row, rowIndex) {
            const status = row.status;
			if (status == '运行中') {
				return 'running-row';
			} else if (status == '异常') {
				return 'error-row'
			}

			return 'close-row';
        },
        // // 重新分配容器
        // reStartPod: function(index, row) {

        // },
        // 登陆容器终端
        loginPod: function (index, row) {

        }
    }
};
</script>

<style>
.el-table .close-row {
    background: #FFFFFF;
}

.el-table .running-row {
    background: #40E0D0;
}

.el-table .error-row {
    background: #FF0000;
}
</style>
